<template>
  <div class="exhibits-content" :style="{ width: props.info.width + 'rem', height: props.info.height + 'rem' }">
    <div class="list">
      <div
        class="decoration-box"
        :style="{
          backgroundImage: `url(${publicUrls + 'free/style5/exhibitionStandStyle5bg4.webp'})`,
        }"
      ></div>
      <div class="item-parent">
        <div
          class="list-left"
          :style="{
            backgroundImage: `url(${publicUrls + 'free/style5/exhibitionStandStyle5bg1.webp'})`,
          }"
        ></div>
        <div
          @contextmenu.stop="emit('onContextMenuChild', $event, index)"
          v-for="(item, index) in props.info.showpieceList"
          :key="index"
          class="exhibits-item"
          :style="{
            backgroundImage: `url(${publicUrls + 'free/style5/exhibitionStandStyle5bg2.webp'})`,
          }"
        >
          <div class="item-content"  @click="viewImg(item.moduleId, item.id)">
            <div class="cover-parent">
              <div class="cover-box">
                <img
                  class="cover"
                  v-lazy="getLinkUrl(item.coverUrl, '?imageView2/3/w/600/format/webp')"
                  alt=""
                 
                />
                <FlowerCom />
              </div>
            </div>

            <div class="items-title" v-if="item.name && item.name.length > 13">
              <p>{{ item.name.slice(0, 13) }}</p>
              <span class="dot"></span>
              <span class="dot"></span>
              <span class="dot"></span>
            </div>
            <p class="items-title" v-else>
              {{ item.name }}
            </p>
          </div>
        </div>
        <div
          class="list-right"
          :style="{
            backgroundImage: `url(${publicUrls + 'free/style5/exhibitionStandStyle5bg3.webp'})`,
          }"
        ></div>
      </div>
    </div>
  </div>
</template> 
 
<script setup lang="ts">
import FlowerCom from '../../displayBoard/style5/flower.vue';
import { publicUrls } from '@/utils/minxin';
import { DraggableContainer } from 'vue3-draggable-resizable';
// import FlotMenu from '@/components/flotMenu/OutlineMenu.vue';
import ContextMenu from '@imengyu/vue3-context-menu';
import { getDraggableNumber, getExhibitsHeightRest, getdisabledY } from '@/utils/getRemComputed';
import { ref, reactive, watch, nextTick } from 'vue';
import { exbitMenuShow, exbitListMenuShow } from '@/hooks/menuHooks';
import { useProjectStore } from '@/store';
import { getLinkUrl } from '@/utils/request/upload';

const emit = defineEmits([
  'emitChildItemDraggable',
  'emitChildItemDraggableStyle',
  'emitShowcaseDraggable',
  'emitShowcaseDraggableStyle',
  'onContextMenuChild',
]);
const store = useProjectStore();
const contextMenuTrigger = ref(); //列表盒子dom
const parentLock = ref(true);
const childShow = ref(true);
const draggableResizable = ref(); //父级拖拽盒子ref
const timer = ref();
const ImgVisible = ref(false);
const ImgUrl = ref('');

const props = defineProps({
  width: {
    type: Number || String,
  },
  height: {
    type: Number || String,
  },
  indexs: {
    type: Number,
  },
  info: {
    type: Object,
  },
  childId: {
    type: Number,
  },
  AuxiliaryId: {
    type: Number,
  },
});

const viewImg = (moduleId: number, e?: number) => {
  store.exhibitsModuleId = moduleId;
  store.exhibitsShowpieceid = e;
  store.exhibitsInfoShow = true;
};

const handleMouseDown = (event) => {
  event.stopPropagation();
};
const preventDefaultDrag = (event) => {
  event.stopPropagation();
};
// watch(
//   () => props.info.width,
//   () => {
//     childShow.value = false;
//     nextTick(() => {
//       childShow.value = true;
//     });
//   },
//   { deep: true },
// );
// watch(
//   () => props.info.height,
//   () => {
//     childShow.value = false;
//     nextTick(() => {
//       childShow.value = true;
//     });
//   },
//   { deep: true },
// );

//
</script>
   
<style lang="less" scoped>
.exhibits-content {
  position: relative;
  display: flex;
  z-index: 999;
  padding: 0 !important;
}
.list {
  display: flex;

  width: 100%;
  height: 100%;
}
.decoration-box {
  width: 288px;
  height: 288px;
  background-repeat: no-repeat;
  background-size: 100% 100%;
  margin-right: 90px;
  -webkit-box-reflect: below 120% linear-gradient(transparent, rgba(0, 0, 0, 0.3));
}
.active {
  :deep(.flot-menu) {
    display: flex;
  }
}
:deep(.active) {
  z-index: 999;
}
:deep(.vdr-handle) {
  z-index: 66;
}
.item-parent {
  display: flex;
  height: 670px;
  margin-top: 36px;
  -webkit-box-reflect: below 0% linear-gradient(transparent, rgba(0, 0, 0, 0.3));
}
.list-left,
.list-right {
  width: 57px;
  height: 670px;
  background-repeat: no-repeat;
  background-size: 100% 100%;
}
.exhibits-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  width: 309px;
  height: 670px;
  background-repeat: no-repeat;
  background-size: 100% 100%;
  // 160
}

.item-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 245px;
  height: 533px;
  background-repeat: no-repeat;
  background-size: 100% 100%;
  margin-top: 68px;
}
.cover-parent {
  display: flex;
  margin-top: 82px;
  width: 237px;
  height: 370px;
  // border-left: 1px solid #7fa399;
  // border-right: 1px solid #7fa399;
}
.cover-box {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  width: 100%;
  height: 370px;
  overflow: hidden;
// background: rgba(64, 109, 98, 0.58);
background: #ECF1EA;
  // border: 1px solid rgba(63, 95, 92, 1);
  // box-shadow: 0px 0px 3.64px 0px rgba(141, 160, 156, 1);
  // background: rgba(225, 231, 225, 1);
}
.cover {
  width: 100%;
  height: auto;
  max-height: 100%;
  object-fit: contain;
  transition: all 0.3s;
}
.exhibits-item:hover {
  .item-content {
    justify-content: center;
  }
  .items-title {
    display: flex;
  }
  .cover-parent {
    display: none;
  }
  // .cover {
  //   transform: scale(1.2);
  // }
}
.items-title {
  display: none;
  flex-direction: column;
  align-items: center;
  width: 20px; 
  font-family: SourceHanSerifCN-Bold;
  font-size: 20px;
  color: rgba(63, 95, 92, 1);
  line-height: 28px;
  text-align: center;
  p {
    display: flex; 
    width: 20px;
    font-family: SourceHanSerifCN-Bold;
    font-size: 20px; 
    color: rgba(63, 95, 92, 1); 
    line-height: 28px;
    letter-spacing: 0.2em;
  }
  .dot {
    width: 3.3px;
    height: 3.3px;
    background: rgba(63, 95, 92, 1);
    border-radius: 50%;
    margin: 0 auto;
    margin-top: 6px;
  }
}
</style>
